// JavaScript Document
//textarea inner html on consultant answer form
function clearIt(oTxt){
  if (oTxt.value==oTxt.defaultValue){
    oTxt.value = "";
  }
}
function resetTxt(oTxt){
  if (oTxt.value==""){
    oTxt.value = oTxt.defaultValue;
	defaulte=oTxt.defaultValue;
  }
}
function CheckedAll(){
	var chk = document.getElementById('frm');
	if(document.getElementById('frm_c').checked){
		for (var i =0; i < chk.elements.length; i++)
			{
				chk.elements[i].checked = true;
			}
		}
	else{
		for (var i =0; i < chk.elements.length; i++)
			{
				chk.elements[i].checked = false;
			}
	}
}
function ReUncheckAll(){
	var test = true;
	var chk= document.getElementById('frm');
	for (var i =0; i < chk.elements.length; i++){
		if(!chk[i].checked){
			test=false;
			}
	}
	if(test){
			document.getElementById('frm_c').checked = true;
		}
	else{
			document.getElementById('frm_u').checked = true;
	}

}
function onSubmit(){
    var checkCount=0;
    var test=document.getElementsByName("bank_ids[]");
    for(i=0;i<test.length;i++){
        if(test[i].checked==true){
            checkCount++;
            bank_url=test[i].id;
        }
    }
    if(checkCount==1){
        $form=document.getElementById("frm");
        var $caturlrewrite;
        $caturlrewrite="";
        try{
            $caturlrewrite=document.getElementById("caturlrewrite").value+"/";
        }catch(err){
            $caturlrewrite="";
        }
        $form.action=$form.action+$caturlrewrite+bank_url+"/";
        //alert($form.action);
    }
    return true;
}
